Skip to content

fix: SSE 세션 구독 엔드포인트에 소유자 인가 검증 추가(#51)#58

Merged
Boyeon-Shin merged 1 commit into
mainfrom
fix/sse-session-authorization
Apr 23, 2026
Merged

fix: SSE 세션 구독 엔드포인트에 소유자 인가 검증 추가(#51)#58
Boyeon-Shin merged 1 commit into
mainfrom
fix/sse-session-authorization

Conversation

@Boyeon-Shin
Copy link
Copy Markdown
Member

📌 관련 이슈 (Related Issue)

📝 작업 내용 (Description)

SSE 세션 구독 엔드포인트에 소유자 인가 검증 추가

🔄 변경 유형 (Type of Change)

  • ✨ 새로운 기능 (feat)
  • 🐛 버그 수정 (fix)
  • 📝 문서 수정 (docs)
  • 💄 스타일 (style)
  • ♻️ 리팩토링 (refactor)
  • ✅ 테스트 (test)
  • 🔧 기타 (chore)

✅ 체크리스트 (Checklist)

  • 코드가 정상적으로 동작하는지 확인했습니다
  • 기존 테스트가 통과합니다
  • 필요한 경우 새로운 테스트를 추가했습니다

@Boyeon-Shin Boyeon-Shin self-assigned this Apr 23, 2026
Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request implements ownership validation for interview session subscriptions by adding a check to ensure the requesting user owns the session. Changes include a new repository method for existence checks and a validation method in the QuestionService. Review feedback suggests optimizing the validation logic with @transactional(readOnly = true), improving code formatting for the if statement, and using RESOURCE_NOT_FOUND instead of FORBIDDEN to enhance security and maintain consistency with other service methods.

Comment on lines +82 to +84
public void validateSessionOwner(UUID sessionId, UUID memberId) {
if(!sessionRepository.existsByIdAndMemberId(sessionId, memberId)) {
throw new BusinessException(ErrorCode.FORBIDDEN);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

데이터베이스 조회 작업의 일관성과 성능 최적화를 위해 @Transactional(readOnly = true) 어노테이션을 추가하고, 자바 코딩 컨벤션에 맞춰 if 문 뒤에 공백을 추가하는 것이 좋습니다. 또한, 동일 클래스의 getQuestion 메서드(45-48라인)와 일관성을 유지하기 위해 권한이 없거나 리소스가 없는 경우 FORBIDDEN 대신 RESOURCE_NOT_FOUND를 사용하는 것을 고려해 보세요. 이는 리소스의 존재 여부를 불필요하게 노출하지 않는 보안 관행과도 부합합니다.

    @Transactional(readOnly = true)
    public void validateSessionOwner(UUID sessionId, UUID memberId) {
        if (!sessionRepository.existsByIdAndMemberId(sessionId, memberId)) {
            throw new BusinessException(ErrorCode.RESOURCE_NOT_FOUND);

@Boyeon-Shin Boyeon-Shin merged commit c3e92bb into main Apr 23, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix: SSE 구독 엔드포인트 권한 확인 누락

1 participant